package cn.lucky.springcloud.client;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @author lingpeng.jiang
 * @create 2020-12-27-15:50
 */
@Component
@FeignClient(value = "CLOUD-PAYMENT-HYSTRIX-SERVICE",fallback = OpenfeignHystrixClientFallBackHandle.class)
public interface OpenfeignHystrixClient {


    /**
     * 正常访问
     * @param id
     * @return
     */
    @GetMapping("/hystrix/payment/ok/{id}")
    String hystrixPaymentInfo_OK(@PathVariable("id") Integer id);


    /**
     * 超时访问
     * @param id
     * @return
     */
    @GetMapping("/hystrix/payment/timeout/{id}")
    String hystrixPaymentInfo_Timeout(@PathVariable("id") Integer id);


    /**
     * 测试熔断
     * @param id
     * @return
     */
    @GetMapping("/hystrix/payment/circuit/{id}")
    String circuitBreaker(@PathVariable("id") Integer id);

    /**
     * 测试负载均衡
     * @return
     */
    @GetMapping("/hystrix/payment/serverPort")
    String getServerPort();
}
